﻿package mortal.game.view.signUp.view
{
    import com.mui.controls.*;
    import com.mui.core.*;
    import flash.events.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.signUp.data.*;
    import mortal.game.view.signUp.util.*;

    public class SignUpTotalDayTagSpr extends GSprite
    {
        private var _defaultBg:GBitmap;
        private var _selBg:GBitmap;
        private var _infoImg:GBitmap;
        private var _dayNum:BitmapNumberText;
        private var _signUpTotalDayData:SignUpTotalDayData;

        public function SignUpTotalDayTagSpr()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = true;
            this.mouseChildren = false;
            this._defaultBg = UIFactory.gBitmap(ImagesConst.SignUpInfoBtn_upSkin, 0, 0, this);
            this._selBg = UIFactory.gBitmap(ImagesConst.SignUpInfoBtn_overSkin, 0, 0, this);
            this._selBg.visible = false;
            this._infoImg = UIFactory.gBitmap("", 9, 6, this);
            this._dayNum = UIFactory.bitmapNumberText(43, 6, "SignUpNum1.png", 19, 23, -9, this);
            this.configEventListener(MouseEvent.MOUSE_OVER, this.onOverHandler);
            this.configEventListener(MouseEvent.MOUSE_OUT, this.onOutHandler);
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            this._signUpTotalDayData = param1 as SignUpTotalDayData;
            if (this._signUpTotalDayData)
            {
                this._dayNum.text = this._signUpTotalDayData.dayNum + "";
                if (this._signUpTotalDayData.isAchieve)
                {
                    this._infoImg.bitmapData = GlobalClass.getBitmapData(ImagesConst.Text_HasSignDay);
                }
                else
                {
                    this._infoImg.bitmapData = GlobalClass.getBitmapData(ImagesConst.Text_RemainDay);
                }
            }
            EffectManager.glowFilterUnReg(this);
            if (SignUpUtil.hasTakableReward(this._signUpTotalDayData.totalDayNum))
            {
                EffectManager.glowFilterReg(this);
            }
            return;
        }// end function

        private function onOverHandler(event:MouseEvent) : void
        {
            CursorManager.showCursor(CursorManager.BUTTON);
            return;
        }// end function

        private function onOutHandler(event:MouseEvent) : void
        {
            CursorManager.hideFromButton();
            return;
        }// end function

        public function set isSel(param1:Boolean) : void
        {
            this._selBg.visible = param1;
            return;
        }// end function

        public function get signUpTotalDayData() : SignUpTotalDayData
        {
            return this._signUpTotalDayData;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            EffectManager.glowFilterUnReg(this);
            this._defaultBg.dispose(param1);
            this._selBg.dispose(param1);
            this._infoImg.dispose(param1);
            this._dayNum.dispose(param1);
            this._defaultBg = null;
            this._selBg = null;
            this._infoImg = null;
            this._dayNum = null;
            this._signUpTotalDayData = null;
            return;
        }// end function

    }
}
